import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.fisco.bcos.sdk.abi.FunctionReturnDecoder;
import org.fisco.bcos.sdk.abi.TypeReference;
import org.fisco.bcos.sdk.abi.datatypes.Bool;
import org.fisco.bcos.sdk.abi.datatypes.DynamicArray;
import org.fisco.bcos.sdk.abi.datatypes.Function;
import org.fisco.bcos.sdk.abi.datatypes.Type;
import org.fisco.bcos.sdk.abi.datatypes.Utf8String;
import org.fisco.bcos.sdk.abi.datatypes.generated.Uint256;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple1;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple2;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple3;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple4;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple6;
import org.fisco.bcos.sdk.client.Client;
import org.fisco.bcos.sdk.contract.Contract;
import org.fisco.bcos.sdk.crypto.CryptoSuite;
import org.fisco.bcos.sdk.crypto.keypair.CryptoKeyPair;
import org.fisco.bcos.sdk.model.CryptoType;
import org.fisco.bcos.sdk.model.TransactionReceipt;
import org.fisco.bcos.sdk.model.callback.TransactionCallback;
import org.fisco.bcos.sdk.transaction.model.exception.ContractException;

@SuppressWarnings("unchecked")
public class Shipment extends Contract {
    public static final String[] BINARY_ARRAY = {"608060405260016003556001600455600160055534801561001f57600080fd5b506110e38061002f6000396000f3006080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063092b3740146100b457806318b8275a1461024757806341c65276146102b05780634de52651146102f55780635c622a0e146103775780635df2d3681461041d578063723331bb146104e0578063a2d9d6b014610525578063b6f46fbf146105a2578063cff8fd69146105cd578063fe5f937e146105f8575b600080fd5b3480156100c057600080fd5b506100df600480360381019080803590602001909291905050506106a7565b60405180878152602001806020018060200180602001868152602001858152602001848103845289818151815260200191508051906020019080838360005b8381101561013957808201518184015260208101905061011e565b50505050905090810190601f1680156101665780820380516001836020036101000a031916815260200191505b50848103835288818151815260200191508051906020019080838360005b8381101561019f578082015181840152602081019050610184565b50505050905090810190601f1680156101cc5780820380516001836020036101000a031916815260200191505b50848103825287818151815260200191508051906020019080838360005b838110156102055780820151818401526020810190506101ea565b50505050905090810190601f1680156102325780820380516001836020036101000a031916815260200191505b50995050505050505050505060405180910390f35b34801561025357600080fd5b506102ae600480360381019080803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061093d565b005b3480156102bc57600080fd5b506102db600480360381019080803590602001909291905050506109cb565b604051808215151515815260200191505060405180910390f35b34801561030157600080fd5b50610320600480360381019080803590602001909291905050506109ee565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610363578082015181840152602081019050610348565b505050509050019250505060405180910390f35b34801561038357600080fd5b506103a260048036038101908080359060200190929190505050610a68565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e25780820151818401526020810190506103c7565b50505050905090810190601f16801561040f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561042957600080fd5b506104de6004803603810190808035906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610b2d565b005b3480156104ec57600080fd5b5061050b60048036038101908080359060200190929190505050610cde565b604051808215151515815260200191505060405180910390f35b34801561053157600080fd5b506105a06004803603810190808035906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610d00565b005b3480156105ae57600080fd5b506105b7610d7a565b6040518082815260200191505060405180910390f35b3480156105d957600080fd5b506105e2610d87565b6040518082815260200191505060405180910390f35b34801561060457600080fd5b506106a5600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610d94565b005b600060608060606000806106b9610ebc565b6002600189038154811015156106cb57fe5b90600052602060002090600802016101006040519081016040529081600082015481526020016001820154815260200160028201548152602001600382018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561079d5780601f106107725761010080835404028352916020019161079d565b820191906000526020600020905b81548152906001019060200180831161078057829003601f168201915b50505050508152602001600482018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561083f5780601f106108145761010080835404028352916020019161083f565b820191906000526020600020905b81548152906001019060200180831161082257829003601f168201915b50505050508152602001600582018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108e15780601f106108b6576101008083540402835291602001916108e1565b820191906000526020600020905b8154815290600101906020018083116108c457829003601f168201915b505050505081526020016006820154815260200160078201548152505090508060000151816060015182608001518360a001518460c001518560e001518494508393508292509650965096509650965096505091939550919395565b610945610f02565b604080519081016040528060035481526020018381525090506001600360008282540192505081905550600081908060018154018082558091505090600182039060005260206000209060020201600090919290919091506000820151816000015560208201518160010190805190602001906109c3929190610f1c565b505050505050565b6000600180549050821115156109e457600190506109e9565b600090505b919050565b60606001808303815481101515610a0157fe5b9060005260206000209060040201600301805480602002602001604051908101604052809291908181526020018280548015610a5c57602002820191906000526020600020905b815481526020019060010190808311610a48575b50505050509050919050565b6060600260018303815481101515610a7c57fe5b90600052602060002090600802016005018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b215780601f10610af657610100808354040283529160200191610b21565b820191906000526020600020905b815481529060010190602001808311610b0457829003601f168201915b50505050509050919050565b6000610b37610ebc565b610b4086610cde565b91508115610cd6576001808603815481101515610b5957fe5b906000526020600020906004020160030160055490806001815401808255809150509060018203906000526020600020016000909192909190915055506101006040519081016040528060055481526020018781526020018681526020018581526020018481526020016040805190810160405280600981526020017fe5be85e58f91e8b4a7000000000000000000000000000000000000000000000081525081526020014281526020014281525090506001600560008282540192505081905550600281908060018154018082558091505090600182039060005260206000209060080201600090919290919091506000820151816000015560208201518160010155604082015181600201556060820151816003019080519060200190610c83929190610f1c565b506080820151816004019080519060200190610ca0929190610f1c565b5060a0820151816005019080519060200190610cbd929190610f1c565b5060c0820151816006015560e082015181600701555050505b505050505050565b6000808054905082111515610cf65760019050610cfb565b600090505b919050565b6000610d0b846109cb565b90508015610d745781600260018503815481101515610d2657fe5b90600052602060002090600802016005019080519060200190610d4a929190610f9c565b5042600260018503815481101515610d5e57fe5b9060005260206000209060080201600701819055505b50505050565b6000600160035403905090565b6000600160035403905090565b6000610d9e61101c565b608060405190810160405280600454815260200185815260200184815260200183805480602002602001604051908101604052809291908181526020018280548015610e0957602002820191906000526020600020905b815481526020019060010190808311610df5575b50505050508152509050600160046000828254019250508190555060018190806001815401808255809150509060018203906000526020600020906004020160009091929091909150600082015181600001556020820151816001019080519060200190610e78929190610f1c565b506040820151816002019080519060200190610e95929190610f1c565b506060820151816003019080519060200190610eb2929190611045565b5050505050505050565b6101006040519081016040528060008152602001600081526020016000815260200160608152602001606081526020016060815260200160008152602001600081525090565b604080519081016040528060008152602001606081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610f5d57805160ff1916838001178555610f8b565b82800160010185558215610f8b579182015b82811115610f8a578251825591602001919060010190610f6f565b5b509050610f989190611092565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610fdd57805160ff","191683800117855561100b565b8280016001018555821561100b579182015b8281111561100a578251825591602001919060010190610fef565b5b5090506110189190611092565b5090565b608060405190810160405280600081526020016060815260200160608152602001606081525090565b828054828255906000526020600020908101928215611081579160200282015b82811115611080578251825591602001919060010190611065565b5b50905061108e9190611092565b5090565b6110b491905b808211156110b0576000816000905550600101611098565b5090565b905600a165627a7a72305820df8be87e761d57f38a0e49360a5f22aaa853556dff20aed29e7965fffbfe50bb0029"};

    public static final String BINARY = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", BINARY_ARRAY);

    public static final String[] SM_BINARY_ARRAY = {};

    public static final String SM_BINARY = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", SM_BINARY_ARRAY);

    public static final String[] ABI_ARRAY = {"[{\"constant\":true,\"inputs\":[{\"name\":\"_id\",\"type\":\"uint256\"}],\"name\":\"getShipment\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"},{\"name\":\"\",\"type\":\"string\"},{\"name\":\"\",\"type\":\"string\"},{\"name\":\"\",\"type\":\"string\"},{\"name\":\"\",\"type\":\"uint256\"},{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"addUser\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_id\",\"type\":\"uint256\"}],\"name\":\"checkCarrier\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_id\",\"type\":\"uint256\"}],\"name\":\"getShipmentsByCarrier\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_id\",\"type\":\"uint256\"}],\"name\":\"getStatus\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_id\",\"type\":\"uint256\"},{\"name\":\"_carrier_id\",\"type\":\"uint256\"},{\"name\":\"_from\",\"type\":\"string\"},{\"name\":\"_to\",\"type\":\"string\"}],\"name\":\"addShipment\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_id\",\"type\":\"uint256\"}],\"name\":\"checkUser\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_id_carrier\",\"type\":\"uint256\"},{\"name\":\"_id_shipment\",\"type\":\"uint256\"},{\"name\":\"_status\",\"type\":\"string\"}],\"name\":\"updateStatus\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getShipmentslenfth\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getuser\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_name\",\"type\":\"string\"},{\"name\":\"_info\",\"type\":\"string\"}],\"name\":\"addCarrier\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"};

    public static final String ABI = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", ABI_ARRAY);

    public static final String FUNC_GETSHIPMENT = "getShipment";

    public static final String FUNC_ADDUSER = "addUser";

    public static final String FUNC_CHECKCARRIER = "checkCarrier";

    public static final String FUNC_GETSHIPMENTSBYCARRIER = "getShipmentsByCarrier";

    public static final String FUNC_GETSTATUS = "getStatus";

    public static final String FUNC_ADDSHIPMENT = "addShipment";

    public static final String FUNC_CHECKUSER = "checkUser";

    public static final String FUNC_UPDATESTATUS = "updateStatus";

    public static final String FUNC_GETSHIPMENTSLENFTH = "getShipmentslenfth";

    public static final String FUNC_GETUSER = "getuser";

    public static final String FUNC_ADDCARRIER = "addCarrier";

    protected Shipment(String contractAddress, Client client, CryptoKeyPair credential) {
        super(getBinary(client.getCryptoSuite()), contractAddress, client, credential);
    }

    public static String getBinary(CryptoSuite cryptoSuite) {
        return (cryptoSuite.getCryptoTypeConfig() == CryptoType.ECDSA_TYPE ? BINARY : SM_BINARY);
    }

    public Tuple6<BigInteger, String, String, String, BigInteger, BigInteger> getShipment(BigInteger _id) throws ContractException {
        final Function function = new Function(FUNC_GETSHIPMENT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id)), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Uint256>() {}, new TypeReference<Uint256>() {}));
        List<Type> results = executeCallWithMultipleValueReturn(function);
        return new Tuple6<BigInteger, String, String, String, BigInteger, BigInteger>(
                (BigInteger) results.get(0).getValue(), 
                (String) results.get(1).getValue(), 
                (String) results.get(2).getValue(), 
                (String) results.get(3).getValue(), 
                (BigInteger) results.get(4).getValue(), 
                (BigInteger) results.get(5).getValue());
    }

    public TransactionReceipt addUser(String _name) {
        final Function function = new Function(
                FUNC_ADDUSER, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_name)), 
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public byte[] addUser(String _name, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_ADDUSER, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_name)), 
                Collections.<TypeReference<?>>emptyList());
        return asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForAddUser(String _name) {
        final Function function = new Function(
                FUNC_ADDUSER, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_name)), 
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple1<String> getAddUserInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_ADDUSER, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple1<String>(

                (String) results.get(0).getValue()
                );
    }

    public Boolean checkCarrier(BigInteger _id) throws ContractException {
        final Function function = new Function(FUNC_CHECKCARRIER, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id)), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Bool>() {}));
        return executeCallWithSingleValueReturn(function, Boolean.class);
    }

    public List getShipmentsByCarrier(BigInteger _id) throws ContractException {
        final Function function = new Function(FUNC_GETSHIPMENTSBYCARRIER, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id)), 
                Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Uint256>>() {}));
        List<Type> result = (List<Type>) executeCallWithSingleValueReturn(function, List.class);
        return convertToNative(result);
    }

    public String getStatus(BigInteger _id) throws ContractException {
        final Function function = new Function(FUNC_GETSTATUS, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id)), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}));
        return executeCallWithSingleValueReturn(function, String.class);
    }

    public TransactionReceipt addShipment(BigInteger _id, BigInteger _carrier_id, String _from, String _to) {
        final Function function = new Function(
                FUNC_ADDSHIPMENT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id), 
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_carrier_id), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_from), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_to)), 
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public byte[] addShipment(BigInteger _id, BigInteger _carrier_id, String _from, String _to, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_ADDSHIPMENT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id), 
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_carrier_id), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_from), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_to)), 
                Collections.<TypeReference<?>>emptyList());
        return asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForAddShipment(BigInteger _id, BigInteger _carrier_id, String _from, String _to) {
        final Function function = new Function(
                FUNC_ADDSHIPMENT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id), 
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_carrier_id), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_from), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_to)), 
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple4<BigInteger, BigInteger, String, String> getAddShipmentInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_ADDSHIPMENT, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}, new TypeReference<Uint256>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple4<BigInteger, BigInteger, String, String>(

                (BigInteger) results.get(0).getValue(), 
                (BigInteger) results.get(1).getValue(), 
                (String) results.get(2).getValue(), 
                (String) results.get(3).getValue()
                );
    }

    public Boolean checkUser(BigInteger _id) throws ContractException {
        final Function function = new Function(FUNC_CHECKUSER, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id)), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Bool>() {}));
        return executeCallWithSingleValueReturn(function, Boolean.class);
    }

    public TransactionReceipt updateStatus(BigInteger _id_carrier, BigInteger _id_shipment, String _status) {
        final Function function = new Function(
                FUNC_UPDATESTATUS, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id_carrier), 
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id_shipment), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_status)), 
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public byte[] updateStatus(BigInteger _id_carrier, BigInteger _id_shipment, String _status, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_UPDATESTATUS, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id_carrier), 
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id_shipment), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_status)), 
                Collections.<TypeReference<?>>emptyList());
        return asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForUpdateStatus(BigInteger _id_carrier, BigInteger _id_shipment, String _status) {
        final Function function = new Function(
                FUNC_UPDATESTATUS, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id_carrier), 
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id_shipment), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_status)), 
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple3<BigInteger, BigInteger, String> getUpdateStatusInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_UPDATESTATUS, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}, new TypeReference<Uint256>() {}, new TypeReference<Utf8String>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple3<BigInteger, BigInteger, String>(

                (BigInteger) results.get(0).getValue(), 
                (BigInteger) results.get(1).getValue(), 
                (String) results.get(2).getValue()
                );
    }

    public BigInteger getShipmentslenfth() throws ContractException {
        final Function function = new Function(FUNC_GETSHIPMENTSLENFTH, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
        return executeCallWithSingleValueReturn(function, BigInteger.class);
    }

    public BigInteger getuser() throws ContractException {
        final Function function = new Function(FUNC_GETUSER, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
        return executeCallWithSingleValueReturn(function, BigInteger.class);
    }

    public TransactionReceipt addCarrier(String _name, String _info) {
        final Function function = new Function(
                FUNC_ADDCARRIER, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_name), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_info)), 
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public byte[] addCarrier(String _name, String _info, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_ADDCARRIER, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_name), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_info)), 
                Collections.<TypeReference<?>>emptyList());
        return asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForAddCarrier(String _name, String _info) {
        final Function function = new Function(
                FUNC_ADDCARRIER, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_name), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_info)), 
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple2<String, String> getAddCarrierInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_ADDCARRIER, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple2<String, String>(

                (String) results.get(0).getValue(), 
                (String) results.get(1).getValue()
                );
    }

    public static Shipment load(String contractAddress, Client client, CryptoKeyPair credential) {
        return new Shipment(contractAddress, client, credential);
    }

    public static Shipment deploy(Client client, CryptoKeyPair credential) throws ContractException {
        return deploy(Shipment.class, client, credential, getBinary(client.getCryptoSuite()), "");
    }
}
